<?php

/**
 * Occupant form base class.
 *
 * @package    utility
 * @subpackage form
 * @author     Your name here
 */
class BaseOccupantForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'station_id'      => new sfWidgetFormPropelChoice(array('model' => 'Station', 'add_empty' => true)),
      'building_id'     => new sfWidgetFormPropelChoice(array('model' => 'Building', 'add_empty' => true)),
      'consumer_no'     => new sfWidgetFormInput(),
      'army_no'         => new sfWidgetFormInput(),
      'rank'            => new sfWidgetFormInput(),
      'name'            => new sfWidgetFormInput(),
      'unit'            => new sfWidgetFormInput(),
      'date_occupied'   => new sfWidgetFormDate(),
      'date_vacated'    => new sfWidgetFormDate(),
      'occupied_status' => new sfWidgetFormInput(),
      'occupant_state'  => new sfWidgetFormInput(),
      'status'          => new sfWidgetFormInput(),
      'created_at'      => new sfWidgetFormDate(),
      'updated_at'      => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorPropelChoice(array('model' => 'Occupant', 'column' => 'id', 'required' => false)),
      'station_id'      => new sfValidatorPropelChoice(array('model' => 'Station', 'column' => 'id', 'required' => false)),
      'building_id'     => new sfValidatorPropelChoice(array('model' => 'Building', 'column' => 'id', 'required' => false)),
      'consumer_no'     => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'army_no'         => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'rank'            => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'name'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'unit'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'date_occupied'   => new sfValidatorDate(array('required' => false)),
      'date_vacated'    => new sfValidatorDate(array('required' => false)),
      'occupied_status' => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'occupant_state'  => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'status'          => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'created_at'      => new sfValidatorDate(array('required' => false)),
      'updated_at'      => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('occupant[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Occupant';
  }


}
